<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('百度推送')"/>
    <th:block th:include="include :: summernote-css"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: jquery-smartwizard-css"/>
    <link rel="stylesheet" href="/js/kindeditor/themes/default/default.css"/>
    <script charset="utf-8" src="/js/kindeditor/kindeditor-all.js"></script>
    <script charset="utf-8" src="/js/kindeditor/lang/zh-CN.js"></script>
    <style>
        .contain {
            width: 80%;
            margin-left: 30px;
        }

        .check-box {
            width: 106px;
        }
        .title{
            text-align: left !important;
        }
        .con{
            padding: 24px 0 !important;
        }
        .submit{
            text-align: center !important;
        }
    </style>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-news-add">
        <div class="contain">

            <div class="form-group">
                <div class="col-sm-12">
                    <label class="col-sm-2 control-label">标签</label>
                    <div class="col-sm-10">
                        <label class="radio-box"> <input type="radio"  name="type"  value="01" checked /> PC端 </label>
                        <label class="radio-box"> <input type="radio"  name="type"  value="02" /> M端 </label>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-12">
                    <label class="col-sm-2 control-label">请填写链接地址</label>
                    <div class="col-sm-10">
                        <textarea name="referenceMaterial" id="referenceMaterial" class="form-control "></textarea>
                        <div class="col-sm-10 title" style="color: #a6a6a6">
                            您每次最多可提交20条链接，每行一条
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-10 submit">
                    <button type="button" class="btn btn-success" onclick="submitBaidu()">提交</button>
                </div>
            </div>

        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: summernote-js"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-select-js"/>
<th:block th:include="include :: jquery-smartwizard-js"/>


<script th:inline="javascript">


    function submitBaidu() {
        var urls = $('#referenceMaterial').val(); // 获取<textarea>的值
        var type = $('input[name="type"]:checked').val();
        $.ajax({
            url: '/ydz/push/pushBaidu',
            type: 'POST',
            async: false,
            dataType: 'json',
            data: { urls: urls,type:type },  // 将字符串作为 JSON 数据发送
            success: function (result) {
                if(result.code == "1"){

                    $.modal.alertSuccess("推送成功"+result.data.success+"条。今日剩余可推送"+result.data.remain+"条!");
                }else{
                    $.modal.alertError(result.msg);
                }
            }
        });
    }

</script>
</body>
</html>